﻿@{
    Layout = "~/_SiteLayout.cshtml";
    Page.Title = "Reports";
}

<div id="wrapper">
    <div class="container">
        <section id="top" class="section docs-heading"></section>
        <!-- end section -->
        <div class="row">
            <div class="col-md-3">
                <nav class="docs-sidebar" data-spy="affix" data-offset-top="100" data-offset-bottom="200" role="navigation">
                    <ul class="nav">
                        <li>
                            <a href="#lineModels">Models</a>
                            <ul class="nav">
                                <li><a href="#lineModels_def">Definition</a></li>
                                <li><a href="#lineModels_el">Elements</a></li>
                                <li><a href="#lineModels_restr">Restrictions</a></li>
                                <li><a href="#lineModels_charts">Charts</a></li>
                                <li><a href="#lineModels_sqlm">SQL Model</a></li>
                                <li><a href="#lineModels_linq">LINQ Model</a></li>
                            </ul>
                        </li>
                        <li>
                            <a href="#lineViews">Views</a>
                            <ul class="nav">
                                <li><a href="#lineViews_template">Templates</a></li>
                                <li><a href="#lineViews_rv">Restrictions Views</a></li>
                            </ul>
                        </li>
                        <li>
                            <a href="#lineOutput">Output and Schedules</a>
                            <ul class="nav">
                                <li><a href="#lineOutput_device">Devices</a></li>
                                <li><a href="#lineOutput_schedule">Schedules</a></li>
                            </ul>
                        </li>
                        <li><a href="#lineTasks">Tasks & ETL</a></li>
                        <li><a href="#lineInputs">Input Values</a></li>
                        <li>
                            <a href="#lineConverter">Converter</a>
                            <ul class="nav">
                                <li><a href="#lineConverter_pdf">PDF</a></li>
                                <li><a href="#lineConverter_excel">Excel</a></li>
                            </ul>
                        </li>
                        <li><a href="#lineCopy">Smart Copy</a></li>
                        <li><a href="#lineExecution">Execution Steps</a></li>
                    </ul>
                    <img src="Images/Seal-Report-Logo.png" class="img-thumbnail img-rounded" style="margin-left:20px;" />
                    <p style="margin-left:20px;">
                        <strong><a href="#feed">Feed the Seal ?</a></strong><br />
                        <iframe src="https://ghbtns.com/github-btn.html?user=ariacom&repo=Seal-Report&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
                    </p>

                </nav>
            </div>
            <div class="col-md-9">
                <section class="welcome">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Reports<hr></h2>
                            <div class="row">
                                <div class="col-md-12 full">
                                    <p>
                                        A <strong>Report</strong> is edited with the <b>Report Designer</b> and stored in a file (*.srex) either in the <i>\Reports</i> Repository sub-folder or on the file system.<br>
                                        A report references repository <strong>Data Sources</strong> but it may have its own Data Sources definitions.<br />
                                        A report contains <strong>Models</strong> to define how to generate the Result Set (Data Table) and Series from the database.<br />
                                        Once the result got from the database (for SQL Source) or from script (for LINQ Source), report <strong>Views</strong> are used to generate a HTML document using Razor parsing and rendering.<br />
                                        In addition, <strong>Outputs</strong> and <strong>Schedules</strong> can be defined to automate report generation (<eg>e.g. Sending an Email every morning</eg>).<br />
                                        Report allows also to perform <strong>Tasks</strong> to execute SQL or Razor Scripts.
                                    </p>
                                </div>
                            </div>
                            <!-- end row -->
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12 text-center">
                            <div class="caption">
                                <b>Report Objects</b>
                            </div>
                            <img src="images/CD-Report.png" alt="" class="img-thumbnail img-rounded">
                            <div>
                                <ck>Check also <a href="~/Help/Index.html" target="_blank">Seal Report Library (Seal.Model namespace)</a> for more information</ck>.
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                </section>
                <section id="lineModels" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Models <hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                A <strong>Model</strong> defines how to build the SQL Select or the LINQ Query Statement to get the result set from the database.<br />
                                A report can contain several models referencing different data sources (one data source per model).<br />
                                Once got from the database or from the LINQ query, the result set is processed in a <b>Summary Table</b> and several Pages containing a <b>Page Table</b>, a <b>Data Table</b> and <b>Series</b> if a chart is defined.<br />
                                The <strong>Data Source</strong> chosen defines which elements and restrictions are available to define the model.<br />
                            </p>
                            <div class="bs-callout bs-callout-warning">
                                The SQL generated for a model can be viewed and executed in a normal SQL Editor (<eg>e.g. SQL Management Studio for MS SQLServer</eg>). Just cut and paste your SQL to test it.
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12 text-center">
                            <div class="caption">
                                <b>Report Model Objects</b>
                            </div>
                            <img src="images/CD-Report Model.png" alt="" class="img-thumbnail img-rounded">
                            <div>
                                <ck>Check also <a href="~/Help/Index.html" target="_blank">Seal Report Library (Seal.Model namespace)</a> for more information</ck>.
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <div id="lineModels_def" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Model Definition</h4>
                            <p>
                                Once the <code>Source</code> defined, the <code>Connection</code> can also be chosen for the model.<br />
                                Several scripts allow to modify the model before or after the table is loaded and processed: <code>Pre Load Script</code>, <code>Post Load Script</code>, <code>Final Script</code>.<br />
                                You can also override the default SQL generated with the following properties :
                                <code>Select Clause</code>,<code>From Clause</code>,<code>Order By Clause</code>,<code>Group By Clause</code>,<code>Common Table Expression Clause</code><br />
                            </p>
                            <p>
                                As a model can depend on other model generation (<eg>e.g. you may use the ResultTable of another model in one of the <code>Load Scripts</code>, but you want to be sure that is has been executed</eg>), the <code>Execution set</code> property allows to define when the model is generated during the report execution.<br />
                            </p>
                            <div class="bs-callout bs-callout-demo">
                                <h4>Samples</h4>
                                In MS MSQLServer, set the <code>Select Clause</code> to <b>SELECT TOP 100</b> to limit the result to 100 records.<br />
                                Add a custom restriction in the <code>From Clause</code> to enhance your SQL performances.<br />
                                Add a column in the <code>Order By Clause</code> to sort the result on a column not shown in the report.<br />
                            </div>
                            <p>
                                Like tables in <strong>Data Source</strong>, <code>Pre/Post SQL Statements</code> can be executed just before and after the SELECT statement is executed.<br />
                                Finally ,the model definition allows to configure build timeout and join preferences, and to edit all the <a href="Sources.cshtml#lineTables_cr">Common Restrictions</a> found in the SQL generated for the model (use the property <code>Common Restrictions</code>).
                            </p>
                            <div class="col-md-12 text-center">
                                <div class="caption">
                                    <b>Model components generated for a SQL Data Source</b>
                                </div>
                                <img src="images/model-sql.png" alt="" class="img-thumbnail img-rounded">
                            </div>
                        </div>
                    </div>
                    <!-- end row -->
                    <div id="lineModels_el" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Elements</h4>
                            <p>
                                The <strong>Data Source</strong> chosen for the model defines the elements available<br />
                                You can drag and drop the elements you want to see in your report in four different panels corresponding to a cross table definition:<br />
                                <b>Row/Column</b> for the dimensions of the result table, <b>Data</b> for the measures aggregated and <b>Page</b> to force a new page per page value.
                            </p>
                            <div class="bs-callout bs-callout-warning">
                                Simply, drag and drop your elements to the <b>Row</b> panel to display a simple table in your report. If your element is a measure (like an amount), drag it to the <b>Data</b> panel to have more options.
                            </div>
                            <div class="bs-callout bs-callout-danger">
                                If you are not familiar with cross tables, please check "Cross Table" or "Excel Pivot Table" on the internet to learn what is a cross table, a dimension and a measure.
                            </div>
                            <p>
                                Once chosen, the element can have a custom <code>Name</code>, and <code>Sort order</code>.<br>
                                The sort priority is the following: First <b>Page</b> elements, then <b>Row/Column</b> elements  and finally <b>Data</b> elements.<br>

                                In addition, the element <code>Data type</code> and <code>Format</code> can be modified to change the display result.<br />
                            </p>
                            <p><strong>Properties for Data element</strong></p>
                            <ul>
                                <li>
                                    <code>Aggregate</code> to choose which aggregation will be done: Sum, Average, Count, Min, Max.
                                </li>
                                <li>
                                    <code>Calculation option</code> to change the display in % of the row, column or total.
                                </li>
                                <li>
                                    <code>Totals</code> to add extra line or column containing the total of the other cells in the result table.
                                </li>
                            </ul>

                            <p><strong>Advanced Properties</strong></p>
                            <ul>
                                <li>
                                    <code>Custom SQL</code> to change the default SQL used for the element (which comes from the column name).<br />
                                    By changing the SQL, you can use all SQL functions/operators/features supported by the database engine or other column of the table. Thus, formula can be defined at this level.
                                    Once modified, be sure that the new SQL generated is still correct (F8).<br />
                                </li>
                                <li>
                                    <code>Cell script</code> to execute a razor script when the table cell is generated.<br />
                                    The script can modify cell presentation and value (<eg>e.g. Setting the font color in red if the value is negative, calculating a progression or a running total, etc.</eg>).<br />
                                    Using cell scripts can be time consuming as the script is executed for each cell of the tables generated.
                                </li>
                                <li>
                                    <code>Custom enumerated list</code> to force an existing enumerated list to use its display and sort.
                                </li>
                            </ul>
                            <div class="bs-callout bs-callout-demo">
                                <h4>Custom SQL Samples</h4>
                                Replace <b>Orders.Amount</b> by <b>2*Orders.Amount</b> to multiply your measure by 2.<br />
                                Replace <b>Orders.Amount</b> by <b>Orders.Amount/Orders.Quantity</b> to get a unit price.<br />
                                Change <b>Country</b> by a <b>CASE WHEN Country='France' THEN 'Other' ELSE Country END</b> Clause to categorize your countries.
                            </div>
                            <div class="bs-callout bs-callout-demo">
                                <h4>Cell script</h4>
                                <a class="btn btn-primary live-sample">Live Sample: 05-Scripts/501-Cell Script - Progression and running totals</a><br />
                                Two columns have been added in the report model with custom Cell script: One to calculate the Progression and the other one to calculate the Running Total.
                            </div>
                            <div class="bs-callout bs-callout-warning">
                                <h4>Sharing elements and restrictions amongst models</h4>
                                If your report contains several models having the same elements or restrictions, you can configure one model and reference it from the other models using the <code>Reference model</code> property.<br />
                                <eg>e.g. All models have the same elements or restrictions, etc.</eg><br />
                                <a class="btn btn-primary live-sample">Live Sample: 14-Sharing Models and Views properties</a><br />
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineModels_restr" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Restrictions</h4>
                            <p>
                                Restrictions are used to filter data displayed in the report result<br>
                                You can drag and drop the elements into the <b>Restrictions text</b> or into the <b>Aggregate Restrictions text</b> to add the restriction to the model.<br />

                                The <b>Restrictions text</b> is then used in the SQL WHERE Clause and the <b>Aggregate Restrictions text</b> in the SQL HAVING Clause.
                            </p>
                            <div class="bs-callout bs-callout-demo">
                                In this sample the <b>Restrictions text</b> contains the restriction on Country and the <b>Aggregate Restrictions text</b> on Amount with the Sum aggregate.
                                <pre class="brush: sql; highlight: [2,4]">
                                SELECT Country,SUM(Amount) FROM Orders 
                                WHERE Country='France' 
                                GROUP BY Country 
                                HAVING SUM(Amount)>10)
                            </pre>
                            </div>
                            <p>
                                A restriction inherits from an element, thus several properties are common: <code>Name</code>, <code>Data type</code>, <code>Custom SQL</code>, <code>Custom enumerated list</code>.<br />
                                The operators available for the <code>Operator</code> property depend on the element type (Text, Numeric or Date &amp; Time).
                            </p>
                            <p>
                                <strong>Date  &amp; Time keywords</strong><br />
                                If the restriction is a Date &amp; Time, keywords can be used to have value relative to the execution date time: <b>Now</b>, <b>Today</b> for the current day, <b>ThisMonth</b> for the first day of the current month, etc.<br>
                                In addition to the keyword, the value can be changed by +/- operations with a given unit (s for seconds, m for minutes, h for hours, D for Days, W for Weeks, M for Months, Q for Quarters, S for Semesters, Y for Years)
                            </p>
                            <div class="bs-callout bs-callout-demo">
                                <h4>Keywords Samples</h4>
                                <b>'Today - 1D'</b> is yesterday<br />
                                <b>'ThisMonth +1M - 1D'</b> is the end of the current month<br />
                                <b>'ThisQuarter +1Q - 1D'</b> is the end of the current quarter<br />
                                <b>'Now+1.5s -2m +3h'</b> gives the current time plus 1.5 seconds, minus 2 minutes and plus 3 hours...
                            </div>
                            <p>
                                <strong>Prompting the value at execution</strong><br />
                                When the report is executed, the restriction value can be prompted to end-user by modifying the <code>Prompt Restriction</code> property.<br />
                                In this case, the properties <code>Trigger execution</code>, <code>Is Required</code> and <code>Operator style</code> can be set.<br />
                                If the restriction has an Enumerated List, other properties allow to control its display layout (<code>Enum Layout</code>) and the values selected the first time (<code>First selection</code>).
                            </p>
                            <div class="bs-callout bs-callout-warning">
                                <h4>Sharing prompted restrictions amongst models</h4>
                                If several restrictions have the <b>same display name and the same metadata source column</b>, only one restriction will be prompted (the one with the lowest display order) and the values will be dispatched to all model restrictions.<br />
                                This is also applied for <a href="Sources.cshtml#lineTables_cr" ">Common Restrictions</a> (but only the <b>name</b> is used as common restriction does not have source column).<br />
                                Another method to share restrictions is demontrated in the report:<br />
                                <a class="btn btn-primary live-sample">Live Sample: 14-Sharing Models and Views properties</a><br />
                            </div>
                            <p>
                                <strong>Flags 'Value only'</strong><br />
                                If the <code>Operator</code> is <b>'Value Only'</b>, the SQL generated for the restriction will not include the column name and operator and set only the value.<br />
                            </p>
                            <div class="bs-callout bs-callout-demo">
                                In the SQL, the restriction <strong>[Country Egals 'France']</strong> will be replaced by <b>Customer.Country = 'France'</b>, but if the <code>Operator</code> is set to <b>'Value only'</b>, the name of the operator is taken from <code>Operator label</code> and the SQL generated is <b>'France'</b><br />
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineModels_charts" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Charts</h4>
                            <p>
                                Charts axis and series are also defined in the report model.<br />
                                Three JavaScript Chart libraries are supported by Seal Report: <strong>Chart JS</strong>, <strong>NVD3 Chart</strong> and <strong>Plotly Chart</strong>. <br />
                                According to the library chosen, the look and functionalities are different but we recommand to use <strong>Chart JS</strong> first (for maintenance and performances reasons).
                            </p>
                            <div class="bs-callout bs-callout-warning">
                                To define a simple chart, select one <b>Row/Column</b> element and set the <code>Serie Definition</code> property to <b>Axis</b>, then select a <b>Data</b> element and define the serie with <code>Chart JS serie</code> or <code>NVD3 serie</code> or <code>Plotly serie</code>.
                            </div>
                            <p>
                                Instead of being an axis, a dimension can be a <b>Splitter</b> to create several series when the value changes (<eg>e.g. to create one serie per country</eg>).<br /><br />
                                For <i>Date &amp; Time</i> or <i>Numeric</i> axis element, if the flag <code>Use value for axis</code> is true, the values of the dimension element is used to build the axis values, otherwise the X values are linear.<br /><br />

                                Other properties allow to control <code>Sort type</code> and <code>Sort order</code> of the chart (<eg>e.g. to show the biggest Bars at the start or at the end</eg>) and to define a secondary <code>Y Axis Type</code> (<eg>e.g. to have a serie for amount for Primary Y, and another for quantities for Secondary Y shown on the same chart</eg>).
                            </p>
                            <div class="bs-callout bs-callout-info">
                                <h4>Charts with No Axis</h4>
                                It is also possible to define a chart without axis.<br />
                                In this case the name of the data elements are used to build a single serie with an axis and their values (<eg>e.g. create a pie chart with Amount and Discount elements</eg>)
                            </div>
                            <div class="bs-callout bs-callout-demo">
                                <h4>Charts Samples</h4>
                                <a class="btn btn-primary live-sample">Live Sample: 04-Charts Gallery - Basics</a>
                                <a class="btn btn-primary live-sample">Live Sample: 05-Charts Gallery - Advanced</a><br />
                                These two reports show different chart definitions with their renderings using the three supported libraries.
                                <a class="btn btn-primary live-sample">Live Sample: 04-Charts Gallery - Chart JS Labels</a><br />
                                This report shows how to use the Chart JS Labels.<br />
                                <a class="btn btn-primary live-sample" style="margin-top:5px">Live Sample: 05-Gauges</a>
                                <a class="btn btn-primary live-sample" style="margin-top:5px">Live Sample: 20-KPI</a><br />
                                To show the use of Gauges and Key Performances Indicators (KPI).

                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineModels_sqlm" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>SQL Model</h4>
                            <p>
                                A <strong>SQL Model</strong> is a report model defined with a simple <b>SQL Select Statement</b> edited by the user designing the report.<br />
                                It is equivalent to creating a table with dynamic columns in the <strong>Data Source</strong> with a simplified edition.<br />
                                When the <b>SQL Select Statement</b> is modified, the elements available are updated.<br /><br />

                                The option <code>Use raw SQL</code> indicates to use directly the <b>SQL Select Statement</b> to generate the result table instead of using a 'select * from (<b>SQL Select Statement</b>) a' statement.<br />
                                In this case, aggregations, restrictions and custom SQL cannot be used.<br /><br />

                                Note that the <b>SQL Select Statement</b> may contain <a href="Sources.cshtml#lineTables_cr">Common Restrictions</a>.<br />

                                <div class="bs-callout bs-callout-warning">
                                    <h4>Converting a model</h4>
                                    A <b>SQL Model</b> cannot not have join to other tables defined in the <strong>Data Source</strong>, however you can convert a <b>SQL Model</b> to a normal <b>MetaData Model</b>.<br />
                                    In this case, a new table is create in the <strong>Data Source</strong> and the model elements refer to this new table.<br /><br />
                                    You can also convert a <b>MetaData Model</b> to a <b>SQL Model</b>, the SQL generated for the model will be then used for the <b>SQL Select Statement</b>. This may be useful to customize the SELECT generated for a report.<br /><br />
                                    <i>Just right click on your model in the TreeView to show the conversion popup menu</i>.
                                </div>
                            </p>
                            <div class="bs-callout bs-callout-demo">
                                <h4>SQL Model Sample</h4>
                                <a class="btn btn-primary live-sample">Live Sample: 08-SQL Model - Common Restrictions</a><br />
                                This report shows a simple SQL Model based on the query of the Northwind database sample.<br />
                                A Common Restriction and a Common Value are defined in the SQL and prompted at execution.
                            </div>
                        </div>
                    </div>
                    <!-- end row -->
                    <div id="lineModels_linq" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>LINQ Model</h4>
                            <p>
                                A <strong>LINQ Model</strong> is a model based on a <a href="Sources.cshtml#lineNoSQL"><b>LINQ Data Source</b></a>.<br />
                                It is managed as a normal model except that the Seal engine will generate a <b>LINQ Query</b> instead of an <b>SQL Statement</b> to get the result table.
                            </p>
                            <p>
                                For each model, the engine will generate 0 to many <b>Sub-Models</b> and 0 to many <b>Sub-Tables</b>.<br />
                                One <b>Sub-Model</b> is created for each SQL Data Source involved (by an element or a restriction part of the model).<br />
                                One <b>Sub-Table</b> is created for each No SQL Table involved (by an element or a restriction part of the model).<br />
                                These <b>Sub-Models</b> are models referencing a SQL Data Source and can be edited as normal models (<eg>e.g. adding restrictions, configuring joins, etc.</eg>) except that elements are fixed and cannot be removed.<br />
                                The <b>Sub-Tables</b> properties may also be edited and customized.
                            </p>
                            <p>
                                The <code>LINQ Load Script</code> and <code>LINQ Query Script template</code> properties of the model allow to customize the query generated by the engine.<br>
                                Elements and restrictions of the model can also have a <code>Custom expression</code> to overwrite the default expression generated (<eg>e.g. to create a formula</eg>).
                            </p>
                            <div class="col-md-12 text-center">
                                <div class="caption">
                                    <b>Model components generated for a LINQ Data Source</b>
                                </div>
                                <img src="images/model-linq.png" alt="" class="img-thumbnail img-rounded">
                            </div>
                            <p>&nbsp;</p>
                            <p>
                                In the LINQ Query, elements defined in a <b>No SQL table</b> are named with the <b>Table Name</b> and the <b>Column Name</b> (<eg>e.g. for the objective column of Excel Employee Objective: <i>ExcelEmployeeObjective["objective"]</i></eg>), and elements defined in a <b>Table Link</b> are named using the <b>Data Source Name</b> and the original <b>Column Name</b> (<eg>e.g. for the LastName column of Employees: <i>Northwind["Employees.LastName"]</i></eg>).
                            </p>
                            <div class="bs-callout bs-callout-demo">
                                <h4>LINQ Query Sample</h4>
                                This script is generated for the <code>Excel Employees Objectives</code> model of the report:<br />
                                <a class="btn btn-primary live-sample">Live Sample: 02-LINQ/201-LINQ Samples CSV-Excel-JSON-XML</a><br />
                                <pre class="brush: csharp">
@@using System.Data
@@{
ReportModel model = Model;

//Query
var query =
from Northwind in model.ExecResultTables["Northwind"].AsEnumerable()
join ExcelEmployeeObjective in model.ExecResultTables["ExcelEmployeeObjective"].AsEnumerable() on
new {x1=Helper.ToString(Northwind["Employees.LastName"]), x2=((DateTime)Northwind["DATETIME2FROMPARTS(year(Orders.OrderDate),1,1,0,0,0,0,0)"]).Year}
equals 
new {x1=Helper.ToString(ExcelEmployeeObjective["employee"]), x2=Int32.Parse(ExcelEmployeeObjective["year"].ToString()) }

group new { Northwind,ExcelEmployeeObjective } by new {
  C0=Helper.ToDateTime(Northwind["DATETIME2FROMPARTS(year(Orders.OrderDate),1,1,0,0,0,0,0)"]),
  C1=Helper.ToString(Northwind["Employees.LastName"]),
  C4=Helper.ToDouble(Northwind["Employees.EmployeeID"])
} into g

orderby g.Key.C0,g.Key.C1,g.Sum(i => Helper.ToDouble(i.Northwind["(1-[Order Details].Discount)*[Order Details].Quantity*[Order Details].UnitPrice"])),g.Sum(i => Helper.ToDouble(i.ExcelEmployeeObjective["objective"]))

select new {
  C0=g.Key.C0,
  C1=g.Key.C1,
  C2=g.Sum(i => Helper.ToDouble(i.Northwind["(1-[Order Details].Discount)*[Order Details].Quantity*[Order Details].UnitPrice"])),
  C3=g.Sum(i => Helper.ToDouble(i.ExcelEmployeeObjective["objective"])),
  C4=g.Key.C4
};

//LINQ Query Script
var query2 = query.Distinct();

model.ResultTable = query2.CopyToDataTable2();
}
                    </pre>

                            </div>
                            <div class="bs-callout bs-callout-warning">
                                <h4>Report Restrictions in LINQ</h4>
                                Restrictions are shared amongst the <strong>LINQ Model</strong> and its <b>Sub-Models</b>.<br />
                                For performance reasons, it is recommended to set the restrictions in the <b>Sub-Models</b> of the <strong>LINQ Model</strong>, thus the database engine will perform the filter on the result set.
                            </div>
                        </div>
                    </div>
                    <!-- end row -->
                </section>
                <!-- end section -->
                <section id="lineViews" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Views <hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                <strong>Views</strong> are used to generate the report result from the models results.<br />
                                A view is implemented as a Razor script that will be compiled and executed when rendering the report.<br />
                                A view references a <b>View Template</b>. The template defines the default razor script and the view parameters.<br />
                                The script and the parameters can be customized per view.<br />
                            </p>
                            <p>
                                To be executed, a report has at least a root view referencing the <b>Report Template</b>.<br />
                                A view can have children views, the rendering starts from the root view and ends at the last child views (from top to bottom).<br />
                                After the execution of the view, the HTML or the text generated is appended to the report result.<br />

                                A view has several parameters to change the rendering (<eg>e.g. changing the legend position in a chart, add CSS styles, etc.</eg>).<br />
                                The parameters are defined in the view template configuration file. They may have different purposes and depends on the components/items handled by the view.
                            </p>
                            <p>
                                <strong>Model Views</strong><br />
                                Certain views reference a model, in the case the rendering is done using the model results.<br>
                                When executed, a report model has a report model result: one summary table and several result pages. Each page has a Page Table, a Data Table and Chart Series.<br />
                                Thus , there are dedicated views to render these results.
                            </p>
                            <div class="bs-callout bs-callout-warning">
                                <h4>Customize your rendering</h4>
                                If necessary, the view scripts can be customized to get the rendering you want.<br />
                                Set the <code>Use custom template</code> flag to true and edit the <code>Custom template property</code>.<br />
                                If the view has <b>Partial Templates</b>, you can modify them using the <code>Custom Partial Templates</code> collection.
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineViews_template" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Templates</h4>
                            <p>
                                All <b>View Templates</b> are defined in files located in the <i>\Views</i> Repository sub-folder.<br>
                                Here is the list of the current view templates supported:
                            </p>
                            <ul>
                                <li><b>Report</b>: Root view containing all the code necessary for the report execution.</li>
                                <li><b>Model</b>: Main view to display a model. Its children are dedicated to view each part of the model result: Page tables, Data tables, Charts, KPI.</li>
                                <li><b>Model Detail</b>: Show a model as a detailed record. This view works for a model result having a single record.</li>
                                <li><b>Container</b>: A Boostrap layout container (refer to Bootstrap 3 grid at <a href="https://getbootstrap.com/docs/3.4/css/#grid" target="_blank">https://getbootstrap.com/docs/3.4/css/#grid</a>). </li>
                                <li><b>Container Grid Flex</b>: A Grid or Flex layout container (refer to CSS references at <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_grid_layout/Basic_concepts_of_grid_layout" target="_blank">https://getbootstrap.com/docs/3.4/css/#grid</a>). </li>
                                <li><b>Card</b>: A view to display each model values in a single card.</li>
                                <li><b>Widget</b>: A container to display a panel with a title, icon and color. A optional report can be executed from the title.</li>
                                <li><b>Tab Control</b>: A Tab Control container. Only Tab Page children can be defined from this view.</li>
                                <li><b>Tab Page</b>: Container for a given page of the parent Tab Control. The name of the view is used for the Tab.</li>
                                <li><b>Free</b>: Empty view that can be used freely to add HTML or text during the rendering.</li>
                                <li><b>Restrictions</b>: Render some selected report restrictions (named View Restrictions) to display model Views dynamically through restriction Triggers or a Refresh button (refer to <a href="~/Reports.cshtml#lineViews_rv">Restriction Views</a>).</li>
                            </ul>
                            <p>
                                From a Model view, the following children are supported and are applied per page result:
                            </p>
                            <ul>
                                <li><b>Page Table</b>: Render the Page table of the page result.</li>
                                <li><b>Data Table</b>: Render the Data table of the page result (use of the <a href="https://datatables.net/" target="_blank">DataTables</a> JavaScript Component).</li>
                                <li><b>Chart JS:</b> Render the Chart JS series of the page result</li>
                                <li><b>NVD3 Chart</b>: Render the NVD3 series of the page result</li>
                                <li><b>Plotly Chart</b>: Render the Plotly series of the page result</li>
                                <li><b>KPI</b>: Display a Key Performance Indicator. The KPI is built from a data table result with at least 2 columns: 1 for the dimension, 1 for the measure (with optional columns to define the goal if the column name has the _GOAL suffix).</li>
                                <li><b>Gauge</b>: Display a Gauge built from a data table result having at least 1 row and 1 column for the value. 3 optionals columns can be used to set minimum, maximum and animation speed.</li>
                            </ul>

                            <div class="bs-callout bs-callout-info">
                                <h4>Data Tables: Server Pagination</h4>
                                By default and for performances reason, <b>tables</b> are displayed using server pagination, this means that the cell values of a page are sent to the browser when the user click on a page number.
                                (<ck>Refer to <a href="https://www.datatables.net/manual/server-side" target="_blank">Data Tables Server Side processing</a> for more information).</ck><br>
                                For a report, the server pagination can be enabled or disabled using the root view parameter and the model view <code>Options: Server pagination enabled</code>.
                            </div>

                            <div class="bs-callout bs-callout-warning">
                                Try some useful parameters of a <b>Report</b> View:
                                <ul>
                                    <li><code>Report Format</code> to choose the result format: HTML, CSV, HTML Print, Excel, PDF</li>
                                    <li><code>Display: Execution Messages</code> to control the messages panel of the report result. Use <b>Messages enabled and shown</b> for a report having only tasks.</li>
                                    <li><code>Display: Restrictions per row</code> to configure how many prompted restrictions are displayed per row.</li>
                                    <li><code>Options: Force Execution</code> to execute the report even if a restriction is prompted.</li>
                                    <li><code>Options: Auto-Refresh</code> to re-execute automatically the reports every xx seconds.</li>
                                </ul>
                                Other useful parameters of a <b>Data Table</b> View:
                                <ul>
                                    <li><code>Options: Invert data table</code> to swap the columns and rows of the data table from their original presentation. This is valid only if the server pagination parameter is disabled in the root view and in the related model view.</li>
                                    <li><code>Options: Columns to hide</code> to hide columns in the table (<eg>e.g. the column is only used for a sort or for a calculation</eg>).</li>
                                </ul>
                            </div>

                            <div class="bs-callout bs-callout-info">
                                <h4>Reference view</h4>
                                If your report contains several views sharing the same configuration, you can configure one view and reference it from the other views using the <code>Reference view</code> property.<br />
                                <eg>e.g. All tables of the report have no sort, all JS Charts have the same size, etc.</eg><br />
                                <a class="btn btn-primary live-sample">Live Sample: 14-Sharing Models and Views properties</a><br />
                            </div>

                            <div class="bs-callout bs-callout-warning">
                                <h4>Create your own View Template</h4>
                                It is easy to create your own view templates.<br />
                                Just add two  *.cshtml files in the <i>\Views</i> Repository sub-folder: one for the main script and one for the configuration.
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineViews_rv" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Restriction Views</h4>
                            <p>
                                By default, all prompted restrictions are displayed in a panel located at the top of the report.<br />
                                Using a <strong>Restriction View</strong> allows to show them in any part of the report result.<br />
                                Once the restriction triggered or the <b>Refresh</b> button pressed, the model views impacted by the new restriction value are updated in the report result.<br />
                            </p>
                            <p>
                                The <code>Restrictions</code> property allow to choose the prompted restrictions involved in the view.<br />
                                If one of the restrictions of the view has the <code>Trigger execution</code> flag set to <b>False</b>, a <b>Refresh</b> button is also displayed to allow the execution.
                            </p>
                            <p>
                                If the property <code>Target window</code> is set, the execution occurs in a new window using the optional view defined in <code>Target window: View to execute</code>.
                            </p>
                        </div>
                    </div>
                    <div class="bs-callout bs-callout-demo">
                        <h4>Samples</h4>
                        <a class="btn btn-primary live-sample">Live Sample: 31-Restrictions Views</a><br />
                        This report shows different ways to use <strong>Restriction Views</strong> in a report result.<br /><br />
                    </div>
                    <!-- end col -->
                    <!-- end row -->
                </section>
                <!-- end section -->
                <section id="lineOutput" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Outputs and Schedules<hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                A <strong>Report Output</strong> defines how to generate the report result of a root <strong>View</strong> to an <strong>Output Device</strong> (Folder, File Server or Email).<br />
                                A report can have several outputs on different devices.<br>
                            </p>
                            <p>
                                The execution of an output can differs from the normal report execution in several ways:<br />
                                <code>Custom restrictions</code> to specialize the restriction values of the report.<br />
                                <code>Custom view parameters</code> to change the parameter values of the root view (<eg>e.g. Changing the format to CSV for the output</eg>).<br />
                                <code>Culture</code> to change the culture (<eg>e.g. Changing from English to French</eg>).
                            </p>
                            <p>
                                <strong>Conditional generation</strong><br />
                                If <code>Cancel generation if no records</code> is set to <b>true</b>, the output generation is cancelled if the result set has no records.<br />
                                <code>Pre/Post-generation scripts</code> can be defined and executed before and after the generation.<br />
                                The <code>Pre-generation script</code> allows also to cancel the output generation when more complex conditions are met.
                            </p>
                            <p>
                                <strong>Security</strong><br />
                                As an output can be scheduled and executed by the <b>Task Scheduler</b>, you can define particular security context using the <code>User name</code> and <code>User Groups</code> properties.<br />
                                In this case, the user name and groups are used to execute the output. This may be useful if you have defined dynamic security based on user name or groups.
                            </p>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineOutput_device" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Devices</h4>
                            <p>
                                A <strong>Device</strong> is used to define a <b>Report Output</b>.<br />
                                Two types of devices are supported:
                            </p>
                            <ul>
                                <li>
                                    <b>Folder</b>: To generate the report result into a file on the file system.<br />
                                    The Folder device is always available.
                                </li>
                                <li>
                                    <b>File Server</b>: To generate the report result into a remote directory of a file server.<br />
                                    File Server devices are edited and configured using the <b>Server Manager</b> and are stored in a file (*.scfx) in the <i>\Devices\FileServer</i> Repository sub-folder.<br />
                                    The following protocols are supported: FTP, FTPS, SFTP, SCP.
                                </li>
                                <li>
                                    <b>Email</b>: To send the report result by email through a SMTP server.<br />
                                    Email devices are edited and configured using the <b>Server Manager</b> and are stored in a file (*.scfx) in the <i>\Devices\EMail</i> Repository sub-folder.<br />
                                    The configuration contains all parameters required to send an email through a SMTP server.
                                </li>
                            </ul>
                            <div class="bs-callout bs-callout-danger">
                                Make sure that you have created one <strong>Email Device</strong> with the flag <code>Used for notification</code> set to <b>true</b> to allow schedule notifications.
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineOutput_schedule" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Schedules</h4>
                            <p>
                                A <b>Schedule</b> is a regular execution of a report output.<br />
                                A report output can have several schedules.<br />
                                Several properties allow the configuration of the notifications and fail-over procedures (<eg>e.g. an email sent in case of success or failure, the execution can be retried several times, etc.</eg>).
                            </p>
                            <h5><i>Windows Task Scheduler</i></h5>
                            <p>
                                By default on Windows OS, the execution is done through the standard <b>Windows Task Scheduler</b> via the batch executable <b>Task Scheduler</b> located in the installation directory.<br />
                                All the schedules can then be managed by the <b>MMC (Microsoft Management Console) Task Scheduler</b> under the dedicated folder <b>Seal Report</b>.<br />
                            </p>
                            <h5><i>Seal Report Scheduler</i></h5>
                            <p>
                                On <strong>Linux OS</strong> or <strong>Azure Platform</strong>, a dedicated <b>Seal Report Scheduler</b> may be used instead of the <b>Windows Task Scheduler</b>.<br />
                                Schedule definitions are stored in the dedicated repository folder: <i>\SpecialFolders\Schedules</i> and are executed by either another process or an worker thread in the Web Report Server.<br />
                                <ck>Check dedicated  <a href="~/Tutorials.cshtml#lineScheduler">tutorials</a> for running the <b>Seal Report Scheduler</b></ck>.
                            </p>
                            <div class="bs-callout bs-callout-danger">
                                <h4>Windows Task Scheduler: Check users and synchronization</h4>
                                A Schedule is created by a Windows Users (the one running the <strong>Report Designer</strong> or the <strong>Web Report Server</strong>) but can be executed by another Windows User.<br />
                                Be sure that the Windows User has the <b>rights</b> to execute the report and process the output.<br /><br />
                                You can synchronize schedules from the Server Manager if reports have been moved/copied with the Windows Explorer.<br />
                                Just run the <b>Server Manager</b> in Administrator mode and select the menu <srmenu>Tools->Synchronize Report Schedules...</srmenu>.
                            </div>
                            <div class="bs-callout bs-callout-warning">
                                <h4>Define alerts</h4>
                                Alert and regular checks can be easily implemented using a report and a schedule.<br />
                                Create a SQL Select statement that detects an anomaly in your database.<br />
                                Just create a report output on an email address with the option <code>Cancel generation if no records</code> and schedule it regularly (<eg>e.g. every 15 minutes</eg>).<br />
                                Every 15 minutes, the reports is executed, if a record is returned, an email will be sent.
                            </div>
                            <div class="bs-callout bs-callout-info">
                                To change the default folder name containing the schedules, run the <strong>Server Manager</strong> and select the menu <srmenu>Configuration->Configure Server...</srmenu>, then modify the <code>Task Folder Name</code> property.
                            </div>
                            <div class="bs-callout bs-callout-demo">
                                <h4>System Reports for Schedules</h4>
                                Use dedicated schedule reports from the <i>\Reports\System</i> Repository sub-folder:
                                <ul>
                                    <li>320 Reports - Web Server Schedule Definitions (only valid if the <b>Seal Report Scheduler</b> is used)</li>
                                    <li>360 Reports - Last Schedules Executions (only valid if the Audit database is enabled)</li>
                                </ul>
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                </section>
                <!-- end section -->
                <section id="lineTasks" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Tasks & ETL<hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                A <strong>Report Task</strong> is a SQL or a Razor Script executed at a given step of the report execution.<br />
                                A task references one <strong>Data Source</strong> and one <strong>Connection</strong> and is instanciated from a <strong>Task Template</strong> to define default scripts and parameters.<br />
                                A report can have several tasks executed sequentially from the top to the bottom.<br />
                                A task can have tasks children that are executed sequentially by the parent task.<br />
                                A task can be executed at different <strong>steps</strong> of the report generation (<eg>e.g. A task can be executed after the model generation and before the rendering to modify the result tables</eg>)<br />
                                If a task is a Razor Script, it can stop the report execution by setting the <code>report.Cancel</code> flag to true.<br /> Thus, simple workflows can be implemented with tasks (<eg>e.g. if a given condition fails, the report is cancelled</eg>).<br />
                            </p>
                            <p>
                                Using the <code>Execute for each connection</code> property, a task can be executed for all connections defined in the <strong>Data Source</strong>.
                                <br /><br />

                                As Tasks executes a Razor Script, they can reference, instantiate and use objects from any .Net/.NET Core Assemblies located in the <b>\Assemblies</b> Repository sub-folder.<br />
                            </p>
                            <h4>ETL Tasks</h4>
                            <p>
                                Several <strong>Task Templates</strong> are dedicated to perform ETL operations: Loading an Excel Sheet to a database table, copying tables between databases, unzipping a file, download from FTP Server, etc.<br /><br />
                                The task templates <strong>Loop</strong> (to loop over a list of objects) or <strong>Parallel</strong> (to execute children simultaneously) allow to perform several taks in <b>parallel (multi-threading)</b>.
                            </p>
                            <div class="bs-callout bs-callout-warning">
                                <h4>Task Templates</h4>
                                <i>Execute Report, File Download Upload, File Zip Unzip, Load Excel To Database, Load CSV To Database, Loop, Parallel, etc.</i> are template files defined in <i>/Sources/TaskTemplates</i> Repository sub-folder.<br />
                                By default use the <i>Default</i> template.<br />
                                Just add your own template in this folder.
                            </div>
                            <div class="bs-callout bs-callout-info">
                                <h4>Schedule your tasks</h4>
                                As tasks are part of the report, they can be scheduled as a normal report, even if the model has no element.<br />
                                In the tree view, right click on the <b>Schedules</b> node and select the menu <b>Add Schedule for Report Tasks</b>.
                            </div>

                            <div class="bs-callout bs-callout-demo">
                                <h4>Tasks Samples</h4>
                                Check the Repository Samples from the <i>\Reports\Samples\01-Tasks</i> Repository sub-folder:
                                <ul>
                                    <li>101-Task Refresh Enumerated Lists</li>
                                    <li>102-Task Generate several Report Results</li>
                                    <li>103-Task Update Navigation Link Text</li>
                                    <li>104-Task Add borders to result tables</li>
                                </ul>
                            </div>
                            <div class="bs-callout bs-callout-danger">
                                <h4>ETL Tasks Samples</h4>
                                For ETL features, check the Repository Samples from the <i>\Reports\Samples\06-ETL Tasks</i> Repository sub-folder:
                                <ul>
                                    <li>601-Load Excel Files</li>
                                    <li>602-Load CSV Files</li>
                                    <li>603-Execute Reports</li>
                                    <li>604-Copy Tables from a Database</li>
                                    <li>605-Unzip Files</li>
                                    <li>610-Download Zip from FTP, Unzip and Load tables from Excel</li>
                                    <li>611-Generate Report Results, Zip and Upload to FTP Server</li>
                                </ul>
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                </section>
                <!-- end section -->
                <section id="lineInputs" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Input Values <hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                To prompt a value to the user before executing the tasks or before executing a report, you can define <code>Report Input Values</code> (<eg>e.g. prompt a value before building a temporary table that will be used in the models</eg>).<br />
                                This collection property is available in the root <b>Views</b> folder node of the main Tree View.<br />
                                Like <b>Common Value</b>, the restriction will be prompted when the report is executed and the value can be used in the tasks or in other scripts used to generate the report result..<br />
                                The value prompted can be either a text, a numeric, a date time or values of an enumerated list.<br />
                            </p>
                            <div class="bs-callout bs-callout-demo">
                                Task script to display the report input values:
                                <pre class="brush: csharp; highlight: [5,6,7]">
@@using Seal.Model
@@{
	ReportTask task = Model;
    Report report = task.Report;
    foreach (ReportRestriction restr in report.InputValues) {
        report.LogMessage("[{0}]={1} Value={2}", restr.DisplayNameEl, restr.DisplayText, restr.FirstValue); //You can use restr.Value1, restr.FinalDate1, restr.EnumValues[0], restr.EnumDisplayValue, restr.FirstStringValue, restr.FirstNumericValue, restr.FirstDateValue
    }
}
                                </pre>
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="bs-callout bs-callout-demo">
                        <h4>Input Values Samples</h4>
                        <a class="btn btn-primary live-sample">Live Sample: 03-Input Values/300-Input Values - Connection and threshold</a><br />
                        This reports show the use of 2 input values.
                    </div>
                </section>
                <!-- end section -->
                <section id="lineConverter" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">PDF and Excel Converter <hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                The <b>Excel and PDF Converter</b> is a commercial component available at <a href="https://ariacom.com" target="_blank">https://ariacom.com</a> that allows the generation of the report result in native PDF and Excel files.
                            </p>
                            <div class="bs-callout bs-callout-warning">
                                Download the <a href=" https://ariacom.com/SealConverterDownload" target="_blank">Evaluation Version</a> of the Converter and start converting...<br />
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineConverter_pdf" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>PDF Converter</h4>
                            <p>
                                The <b>PDF Converter</b> render the Print View of an HTML Result into a single PDF document (*.pdf).<br />
                                Thus the HTML Print layout will be the PDF layout.<br />
                                In the root View, several properties are available to configure the document generation (<eg>e.g. margin, password, document information, etc.</eg>)<br /><br />
                                The generation can also be customized using two dedicated scripts in the root View:<br />
                                The <code>PDF Converter Script</code> is used to configure the PDF Converter before the document conversion (<eg>e.g. configuring the header or the footer, etc.</eg>).<br />
                                The <code>PDF Document Script</code> is used to modify the PDF Document after its generation (<eg>e.g. writing additional text, images, etc.</eg>).
                            </p>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div id="lineConverter_excel" class="row" style="padding-top:35px">
                        <div class="col-md-12">
                            <h4>Excel Converter</h4>
                            <p>
                                The <b>Excel Converter</b> allows to generate the report result in a native Excel file (*.xlsx).<br />
                                The document generation is done by the execution of several scripts defined in the views.<br />
                                Their executions follows the rendering order: From the top view to the bottom.<br />
                            </p>

                            <div class="bs-callout bs-callout-info">
                                <h4>Execution steps for the root view</h4>
                                From the root <b>Report View</b>, the <code>Root Script: Main</code> executes the following steps:
                                <ul>
                                    <li>Execution of the <code>Root Script: Configuration</code> script to configure the converter.</li>
                                    <li>Execution of the <code>Root Script: Header</code> script to create the document header.</li>
                                    <li>Creation of the document.</li>
                                    <li>Parsing of all children views and execution of theirs <code>View Script: Main</code> script.</li>
                                    <li>Clean-up and final options.</li>
                                </ul>
                            </div>
                            <br />
                            <div class="bs-callout bs-callout-info">
                                <h4>Execution steps for a child view</h4>
                                From a child <b>View</b>, the <code>View Script: Main</code> executes the following steps:
                                <ul>
                                    <li>Execution of the <code>View Script: Configuration</code> script to change configurations from this view.</li>
                                    <li>Execution of the <code>View Script: Header</code> script to create a header for the view.</li>
                                    <li>If the view has a model, execution of the <code>View Script: Summary table</code> script to generate the summary table of the model.</li>
                                    <li>If the view has a model, for each page of the model result, execution of the <code>View Script: Page table</code>, <code>View Script: Chart</code> and <code>View Script: Data table</code> scripts to process the different components of the page result.</li>
                                    <li>Parsing of all children views and execution of theirs <code>View Script: Main</code> script.</li>
                                </ul>
                            </div>
                            <p>
                                Note that all the view scripts can be modified globally in the root <b>Report View</b> using the <code>Reference Script:</code> properties.
                            </p>


                            <div class="bs-callout bs-callout-warning">
                                <h4>Default Converter Values</h4>
                                All default values of the converter component can be modified with the <b>Server Manager</b> in the Server configuration.<br />
                                <ck>Check <a href="Server.cshtml#lineConfiguration">Server Configuration</a> for more information</ck>.
                            </div>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                </section>
                <!-- end section -->
                <section id="lineCopy" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Smart Copy <hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                When using the <b>Report Designer</b>, the <strong>Smart Copy</strong> feature can be used to ease the report edition.<br />
                                It allows the copy of property values from a source object to several destinations objects (<eg>e.g. applying the same restrictions values to all models, setting the same parameter value to several views, etc.</eg>).<br />
                                In addition, the <strong>Smart Copy</strong> can copy a source object to several destinations objects (<eg>e.g. copying a model in another report, copying an element to another model, etc.</eg>).

                            </p>
                            <div class="bs-callout bs-callout-info">
                                The <strong>Smart Copy</strong> is available on most of the objects edited in a report: Task, Model, View, Output. Just right click on the object in the Tree View to show the popup menu.<br /><br />
                                You can also use the <strong>Smart Copy</strong> when editing a report model: Just right click on a report <b>element</b> or <b>restriction</b> to show the popup menu.
                            </div>
                            <div class="bs-callout bs-callout-warning">
                                <h4>Find and replace using Notepad</h4>
                                As all Seal Report files are XML, you can easily edit them with your favorite <b>NotePad</b> and use its find/replace features.<br />
                                Just save the file and reload the Report (or the Data Source) to check your modifications.<br />
                                This may be also useful to copy MetaData, change Data Source GUID, etc.
                            </div>
                            <!-- end col -->
                        </div>
                        <!-- end row -->
                </section>
                <section id="lineExecution" class="section">
                    <div class="row">
                        <div class="col-md-12 left-align">
                            <h2 class="dark-text">Execution Steps <hr></h2>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                    <div class="row">
                        <div class="col-md-12">
                            <p>
                                When a report is executed, the following process is done:
                            </p>

                            <h4>Step 1: Execute Report Tasks having step 'Before models generation'</h4>
                            <p>
                                Tasks are executed sequentially (SQL or C# Script) from the top to the bottom.<br />
                                If a task has a razor script returning <b>"0"</b>, the report is cancelled.
                            </p>

                            <h4>
                                Step 2: Build Models
                            </h4>
                            <p>
                                Models are grouped and executed sequentially using the <code>Execution set</code> property.<br />
                                Models having the same <code>Execution set</code> are executed in parallel (one model per thread).<br>
                            </p>
                            <h5>
                                Step 2-1: For each model having a <b>SQL Source</b>:
                            </h5>
                            <ul>
                                <li>
                                    Fill the model result table (<em><strong>DataTable</strong></em>)<br>
                                    Run the '<em>Pre Load Script</em>' if any, generate the SQL statement, query the database to fill the result table (<em><strong>DataTable</strong></em>), run the '<em>Post Load Script</em>' if any.<br>
                                </li>
                                <li>Build the model pages: Create the pages (<em><strong>ResultPage</strong></em>) containing the page table (<em><strong>ResultTable</strong></em>) and data table (<em><strong>ResultTable</strong></em>)</li>
                                <li>Create the model Summary Table (<em><strong>ResultTable</strong></em>).</li>
                                <li>Process the totals in the result tables.</li>
                                <li>Handle the '<em>Cell script</em>' for each cell (<em><strong>ResultCell</strong></em>) in the Data tables and then in the Summary table.</li>
                                <li>Calculate the series (this involves calls to '<em>Cell script</em>' if any).</li>
                                <li>Perform final sort.</li>
                                <li>Execute any '<em>Final Script</em>' defined in the models.</li>
                            </ul>
                            <h5>
                                Step 2-2: For each model having a <b>LINQ Source</b>:
                            </h5>
                            <ul>
                                <li>
                                    Fill the model result table (<em><strong>DataTable</strong></em>):<br>
                                    Init <b>Sub-Models</b> and <b>Sub-Tables</b> based on the model definition.<br />
                                    For each sub-model (which have always a SQL Data Source), build the result table (<em><strong>DataTable</strong></em>) as described in the step 2-1.<br />
                                    For each sub-table, build the result table (<em><strong>DataTable</strong></em>) definition using table source '<em>Definition Script</em>' and load it using either the table source '<em>Default Load Script</em>' or the model '<em>Load Script</em>'.<br />
                                    Generate the LINQ query and execute it to fill the result table (<em><strong>DataTable</strong></em>) using result tables of the <b>Sub-Models</b> and the <b>Sub-Tables</b>.
                                </li>
                                <li>Build the model pages: Create the pages (<em><strong>ResultPage</strong></em>) containing the page table (<em><strong>ResultTable</strong></em>) and data table (<em><strong>ResultTable</strong></em>)</li>
                                <li>Create the model Summary Table (<em><strong>ResultTable</strong></em>).</li>
                                <li>Process the totals in the result tables.</li>
                                <li>Handle the '<em>Cell script</em>' for each cell (<em><strong>ResultCell</strong></em>) in the Data tables and then in the Summary table.</li>
                                <li>Calculate the series (this involves calls to '<em>Cell script</em>' if any).</li>
                                <li>Handle Sub-totals to add extra lines.</li>
                                <li>Handle 'Empty if repeated' option to empty repeated values.</li>
                                <li>Perform final sort.</li>
                                <li>Execute any '<em>Final Script</em>' defined in the models.</li>
                            </ul>

                            <h4>Step 3: Execute Report Tasks having step 'Models generated, before rendering'</h4>
                            <p>Tasks execution as Step 1.</p>

                            <h4>Step 4: Render Views</h4>
                            <p>Sequentially render report views from the root Report View to generate the result (from top to bottom).</p>

                            <h4>Step 5: Execute Report Tasks having step 'Rendering is done, before output execution'</h4>
                            <p>Tasks execution as Step 1.</p>

                            <h4>Step 6: Process Output</h4>
                            <p>If any, process the output defined for the execution.</p>
                            <ul>
                                <li>Check if the '<em>Pre Execution Script</em>' returns '0' or option to cancel if no records</li>
                                <li>Execute the output on the selected Device</li>
                                <li>Execute the '<em>Post Execution Script</em>'</li>
                            </ul>

                            <h4>Step 7: Execute Report Tasks having step 'After execution'</h4>
                            <p>Tasks execution as Step 1.</p>
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                </section>
            </div>
            <!-- // end .col -->
        </div>
    </div>
    <!-- // end container -->
</div>
<!-- end wrapper -->

@section scripts {
    <script>
        $(document).ready(function () {
            $("#reports_nav").addClass("active");
        });
    </script>
}
